package com.xishu.dao.jpa;

import com.xishu.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;


public interface UserDao extends JpaRepository<User, Long>, JpaSpecificationExecutor<User> {
    public User findByName(String name);

    public User findByEmail(String email);

    @Query(value = "select  *  from user m where m.name = :name " +
            "and m.flag_delete = false ", nativeQuery = true)
    public List<User> findListByName(String name);

    @Query(value = "select  *  from user m where m.email = :email " +
            "and m.flag_delete = false ", nativeQuery = true)
    public List<User> findListByEmail(String email);
}
